
package com.zzxy.spring12.aspect;


import com.zzxy.spring12.aspect.MyAspectJ;


@Component
@Aspect
public class MyAspectJ {
    @Pointcut("execution(* com.zzxy.spring12.service.impl.*.*(..))")
    public void myPointcut() {

    }

    /*
     * &lt;aop:before method="myBefore" pointcut-ref="myPointcut"/&gt;*/
    public void myBefore(JoinPoint jp) {
        System.out.println("before method " + jp.getSignature().getName());
        System.out.println("before ...");
    }

    public void myAfterReturning(JoinPoint jp,object ret) {
        System.out.println("after returning .."+ ret);
    }


    public Object myAround(ProceedingjoinPoint pjp) throws Throwable {
        System.out.println("around before..");
        Object obj = pjp.proceed();
        System.out.println("around after..");
        return obj;
    }

    public void myThrowoble(JoinPoint jp, Throwable e {
        System.out.println("throwing .."+ e.getMessage());
// write to log
    })

    public void myAfter(JoinPoint jp) {
        System.out.println(jp.getSignature().getName());
        System.out.println("after ...");
    }
}